header image

Week 13

Week 13:
Input Devices


Assignment:
Measure something: add a sensor to a microcontroller board that you have designed and read it.

Attiny45- 8 Pin. Built in clock/charges & Discharges.

To receive a command you need a program that can talk to it.  PySerial is what I will be using.

Temperature Sensor:  
NTC- resistors that vary w/temperature – conductors hop exponent ion & more sensors.
RTD- scatter – more accurate

Bridge:
Fixed resistor/variable resistor.
3 10k – NTC (NTC data sheet.  Single ended or differential)
The .py file will mix the old reading w/new readings to smooth the data.

Designing my board:
I started by looking at the boards shown in Week 13 Input Devices to get a good idea what I would need to make a temperature sensor.

Then I went to Eagle to design my own. You can see the process in the following images using the steps that I had done in previous weeks and learned in week 6.





Eported as an Image and then changed it to Monochromatic and saved the PNG

Then I went http://fabmodules.org/ to create my g-code for the mill.




First milling the traces at 1/64" bit and then doing the outline at 1/32" bit.



After the board was finished I deburred and found my parts.

I did at 2 notches so that the FTDI connector could sit flat after I soldered it on, something I learned from a mistake I made week 6 that was very helpful.

I decided I wanted to start labeling my boards to help with confusion. And you can see the finished board.

Then connected everything to my linux computer with the Atmel Ice and my FTDI cable.

Terminal Screen Shots:

I used the make file that was provided on the input page along with the c file and the python makefile file.hello.temp.45.c hello.temp.45.py
I copied each of the files to a file that I labeled temp.sensor on my desktop. I then opened the makefile and made sure to add the Atmel Ice to the list by adding: program-ice: and atmelice_isp.


Then I cd'd into the file using the command cd ~/Desktop/temp.sensor. Once into the directory I typed the following:
make
make program-ice


Once the board was flashed I used the command: python hello.temp.45.py /dev/ttyUSB0. This did not work as you can see above that I was missing a few things. So I followed the error and looked at line 15 in the file. It shows below that I was missing something called Tkinter and numpy. So I installed them.



I also needed to get pip to help download things faster which I had no used before. So with the commands shown I was back in business. (And I am getting better at typing in the terminal, still a few errors, but I'm improving!)

Then I ran the following command to get the temperature sensor to show the data on the screen: python hello.temp.45.py /dev/ttyUSB0

And here is the finished Input Temperature Sensor!

After getting the temperature sensor to work and doing week 16 (Applications) I went back to alter the C code for the temperature sensor. I decided that the change every 10 millisecond was too much and I wanted it to read more like every 500 milliseconds. So I changed the delay_ms to 500. Here is a picture of the new make program-ice from the terminal:

The new C Code is at the bottom of the list.
The changes to the temp.sensor that I made.

Video file of the change to the C Code and with the new application.

Week 13 Photos